home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
qbdoors.arc
/
DOORS.BAS
next >
Wrap
BASIC Source File
|
1987-11-23
|
3KB
|
66 lines
10 REM ***********************************
20 REM ** DOORS example program **
30 REM ** written by Matt Malden ** Also, down load Doors.bat
40 REM ** on 11/28/85 ** and Doors.doc
50 REM ** to demonstrate the use of the **
60 REM ** RBBS "Doors" feature **
70 REM ** (RBBS (c) by Tom Mack, 1985) **
80 REM ***********************************
100 ON ERROR GOTO 10000
510 REM Read in User's Name, Baud Rate, and other communication variables
520 OPEN "R",1,"b:MESSAGES":FIELD 1,128 AS R$
530 GET 1,2:BPS=VAL(MID$(R$,44,2)):PAR=VAL(MID$(R$,42,2))
540 RN$=LEFT$(R$,30):FOR I=LEN(RN$) TO 1 STEP -1
550 IF MID$(RN$,I,1)<>" " THEN 570
560 NEXT I
570 RN$=LEFT$(RN$,I):REM Rn$=Users name
580 IF PAR=-1 THEN P$="N,8,1,CS,DS,CD" ELSE P$="E,7,1,CS,DS,CD"
590 IF BPS=-3 THEN B$="1200," ELSE B$="300,":REM This line will have to be modified for 2400 baud modems.
600 CLOSE #1
610 MCR=&H3FC:MSR=&H3FE:CR$=CHR$(13):LF$=CHR$(10)
620 OPEN "COM1:"+B$+P$ AS #3
630 KEY OFF:CLS
1000 REM Main Program
1010 LF=0:A$="Do you need line feeds?":GOSUB 4000
1020 IF LEFT$(B$,1)="Y" OR LEFT$(B$,1)="y" THEN LF=1
1030 RANDOMIZE TIMER
1040 NUMBER=INT(RND(1)*100)+1
1050 A$="":GOSUB 2010:A$="I have a number between 1 and 100. Type <Q> at any time to quit.":GOSUB 2010
1060 TRY=1
1070 A$="Guess #"+STR$(TRY)+"?":GOSUB 4000
1080 IF LEFT$(B$,1)="Q" OR LEFT$(B$,1)="q" THEN 5010
1090 GUESS=VAL(B$):IF GUESS<1 OR GUESS>100 OR GUESS<>INT(GUESS) THEN A$="Invalid guess.":GOSUB 2000:GOTO 1070
1100 IF GUESS=NUMBER THEN A$="Yes, that's right!!!":GOSUB 2000:A$="Here we go again......":GOSUB 2010:GOTO 1040
1110 IF GUESS<NUMBER THEN A$="Too low.":GOSUB 2010:GOTO 1130
1120 A$="Too high.":GOSUB 2010
1130 TRY=TRY+1:GOTO 1070
2000 REM Print string with carriage return
2010 PRINT A$:PRINT #3,A$:IF LF=1 THEN PRINT #3,LF$
2020 RETURN
3000 REM Print string with carriage return suppressed
3010 PRINT A$;:PRINT #3,A$;:RETURN
4000 REM Input b$ string (a$ is printed as the question)
4010 B$="":GOSUB 3010
4020 WHILE EOF(3):Y$=INKEY$
4030 IF Y$<>"" THEN 4050 ELSE WEND:Y$="":GOSUB 4170
4040 Y$="":Y$=INPUT$(1,3):IF Y$=CHR$(127) THEN 4140
4050 IF Y$=CHR$(8) OR Y$=CHR$(7) OR Y$=CHR$(26) OR Y$=CHR$(27) THEN 4140
4060 IF Y$<" " AND Y$<>CR$ THEN 4020
4070 PRINT Y$;
4080 PRINT #3,Y$;
4090 IF Y$=CR$ THEN 4120
4100 IF LEN(B$)=>254 THEN A$="Input too long -- Try again":GOSUB 2010:GOTO 4010
4110 B$=B$+Y$:GOTO 4020
4120 IF LF=1 THEN PRINT #3,LF$
4130 RETURN
4140 IF LEN(B$)=0 THEN 4020
4150 B$=LEFT$(B$,LEN(B$)-1):PRINT CHR$(29);CHR$(32);CHR$(29);
4160 PRINT #3,CHR$(8);CHR$(32);CHR$(8);:GOTO 4020
4170 IF INP(MSR)<128 THEN 5020:REM User dropped carrier
4180 RETURN
5000 REM Return to DOS
5010 A$="Now returning to RBBS......":GOSUB 2000
5020 CLOSE 3:OUT MCR,INP(MCR)OR 1:SYSTEM
10000 IF ERR=57 AND ERL=4040 THEN 5020
10010 A$="Error #"+STR$(ERR)+" in line"+STR$(ERL)+". Please tell SYSOP.":GOSUB 2000:GOTO 5010